﻿namespace PortableRiotGames.Interfaces.Team
{
    using Newtonsoft.Json;
    using PortableRiotGames.Infrastructure;
    using PortableRiotGames.Infrastructure.Converters;
    using System;
    using System.Collections.Generic;

    [JsonObject(MemberSerialization.OptOut)]
    [JsonConverter(typeof(JsonGetTeamsResponseConverter))]
    public sealed class GetTeamsResponse : ResponseBase
    {
        public List<GetTeamsResponseTeam> Teams { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseMatchHistory
    {
        public int Assists { get; set; }

        public int Deaths { get; set; }

        public long GameID { get; set; }

        [JsonConverter(typeof(JsonGameModeConverter))]
        public GameMode GameMode { get; set; }

        public bool Invalid { get; set; }

        public int Kills { get; set; }

        [JsonConverter(typeof(JsonEnumConverter<Map>))]
        public Map Map { get; set; }

        public int OpposingTeamKills { get; set; }

        public string OpposingTeamName { get; set; }

        public bool Win { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseMessageOfDay
    {
        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime CreateDate { get; set; }

        public string Message { get; set; }

        public int Version { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseRoster
    {
        public List<GetTeamsResponseTeamMemberInfo> MemberList { get; set; }

        public long OwnerID { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseTeam : ResponseBase
    {
        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime CreateDate { get; set; }

        public string FullID { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime LastGameDate { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime LastJoinDate { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime LastJoinedRankedTeamQueueDate { get; set; }

        public List<GetTeamsResponseMatchHistory> MatchHistory { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime ModifyDate { get; set; }

        public string Name { get; set; }

        public GetTeamsResponseRoster Roster { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime SecondLastJoinDate { get; set; }

        [JsonConverter(typeof(JsonEnumUpperStringConverter<TeamStatus>))]
        public TeamStatus Status { get; set; }

        public string Tag { get; set; }

        public GetTeamsResponseTeamStatSummary TeamStatSummary { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime ThirdLastJoinDate { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseTeamMemberInfo
    {
        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime InviteDate { get; set; }

        [JsonConverter(typeof(JsonDateTimeMiliConverter))]
        public DateTime JoinDate { get; set; }

        public long PlayerID { get; set; }

        [JsonConverter(typeof(JsonEnumUpperStringConverter<TeamMemberInfoStatus>))]
        public TeamMemberInfoStatus Status { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseTeamStatDetail
    {
        public int AverageGamesPlayed { get; set; }

        public string FullID { get; set; }

        public int Losses { get; set; }

        [JsonConverter(typeof(JsonRankedQueueConverter))]
        public RankedQueue TeamStatType { get; set; }

        public int Wins { get; set; }
    }

    [JsonObject(MemberSerialization.OptOut)]
    public sealed class GetTeamsResponseTeamStatSummary
    {
        public string FullID { get; set; }

        public List<GetTeamsResponseTeamStatDetail> TeamStatDetails { get; set; }
    }
}